package com.sketch.controller;

import com.sketch.commom.PageResult;
import com.sketch.commom.Result;
import com.sketch.entity.dto.DeleteDTO;
import com.sketch.entity.dto.SketchInfoDTO;
import com.sketch.service.SketchInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags = "短剧管理 API")
@RequestMapping(value = "/api/sketchInfo")
public class SketchInfoController {
    @Resource
    private SketchInfoService sketchInfoService;

//    /**
//     * 新增或更新短剧
//     */
//    @PostMapping("/addOrUpdate")
//    @ApiOperation("新增或更新短剧")
//    public Result addOrUpdate(@RequestBody SketchInfoDTO sketchInfoDTO) {
//        return sketchInfoService.addOrUpdate(sketchInfoDTO);
//    }
//
//    /**
//     * 短剧列表
//     */
//    @GetMapping("/list")
//    @ApiOperation("短剧列表")
//    public Result<PageResult<SketchInfoDTO>> list(@ApiParam(value = "名称") @RequestParam(required = false) String name,
//                                                  @ApiParam(value = "状态1.连载中 2.完结") @RequestParam(required = false) String status,
//                                                  @ApiParam(value = "分类id") @RequestParam(required = false) Integer categoryId,
//                                                  @RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
//                                                  @RequestParam(value = "size", defaultValue = "20", required = false) Integer size) {
//        return sketchInfoService.list(name, status, categoryId, page, size);
//    }

    /**
     * 短剧详情
     */
    @GetMapping("/detail")
    @ApiOperation("详情页面-详情")
    public Result<SketchInfoDTO> detail(@ApiParam(value = "id") @RequestParam Long id) {
        return sketchInfoService.detail(id);
    }

    @GetMapping("/detail/more")
    @ApiOperation("详情页面-喜欢这部剧的人都在看")
    public Result detaiMore(@ApiParam(value = "id") @RequestParam Long id, @RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
                            @RequestParam(value = "size", defaultValue = "20", required = false) Integer size) {
        return sketchInfoService.detaiMore(id, page, size);
    }


//    /**
//     * 删除
//     */
//    @GetMapping("/delete")
//    @ApiOperation("删除")
//    public Result delete(@RequestBody DeleteDTO deleteDTO) {
//        return sketchInfoService.delete(deleteDTO.getId());
//    }
}
